package com.ytjj.qmyx.supplychain.mapper;

import com.ytjj.qmyx.supplychain.mapper.entity.YxAreas;
import com.ytjj.qmyx.supplychain.mapper.entity.YxCities;
import com.ytjj.qmyx.supplychain.mapper.entity.YxProvinces;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

public interface ProvincesMapper extends Mapper<YxProvinces> {

    @Select("SELECT p.`province` FROM yx_provinces p WHERE p.`province` LIKE concat('',#{province},'%') LIMIT 1")
    String findProvince(String province);

    @Select("SELECT c.`city` FROM yx_cities c WHERE c.`city` LIKE concat('',#{city},'%') LIMIT 1")
    String findCity(String city);

    @Select("SELECT a.`area` FROM yx_areas a WHERE a.`area` LIKE concat('',#{area},'%') LIMIT 1")
    String findArea(String area);

    @Select("SELECT p.* FROM yx_provinces p WHERE p.`provinceid`=#{provinceid} LIMIT 1")
    YxProvinces findProvinceById(Integer provinceid);

    @Select("SELECT c.* FROM yx_cities c WHERE c.`cityid`=#{cityid} LIMIT 1")
    YxCities findCityById(Integer cityid);

    @Select("SELECT a.* FROM yx_areas a WHERE a.`areaid`=#{areaid} LIMIT 1")
    YxAreas findAreaById(Integer areaid);
}
